package cn.hibernatedemo.entity;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import java.util.HashSet;
import java.util.Set;

@Entity
public class Project {
    private long proid;
    private String proname;
    private Set<Employee> emps=new HashSet<Employee>();

    public Set<Employee> getEmps() {
        return emps;
    }

    public void setEmps(Set<Employee> emps) {
        this.emps = emps;
    }

    @Id
    @Column(name = "PROID")
    public long getProid() {
        return proid;
    }

    public void setProid(long proid) {
        this.proid = proid;
    }

    @Basic
    @Column(name = "PRONAME")
    public String getProname() {
        return proname;
    }

    public void setProname(String proname) {
        this.proname = proname;
    }

    public Project(long proid, String proname) {
        this.proid = proid;
        this.proname = proname;
    }

    public Project() {
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Project project = (Project) o;

        if (proid != project.proid) return false;
        if (proname != null ? !proname.equals(project.proname) : project.proname != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = (int) (proid ^ (proid >>> 32));
        result = 31 * result + (proname != null ? proname.hashCode() : 0);
        return result;
    }
}
